package com.kimoge.spring6.validation.methodtwo;

import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Set;

/**
 * @author kimoge
 * @date 2025/8/30
 * @description
 */
@Service
public class MyService1 {
    @Autowired
    private Validator validator;

    public boolean validator(Person person) {
        Set<ConstraintViolation<Person>> validate = validator.validate(person);
        return validate.isEmpty();
    }
}
